#include "activitySelect.h"
<<<<<<< HEAD:cxx/algorithm/src/activitySelect.cc
int activitySelect(vector<pair<int, int>>& times, int start_index, int n)
{
    if (times.empty())
        return 0;
    auto fn = [](pair<int, int> p1, pair<int, int> p2) { return p1.second < p2.second; };
    sort(times.begin(), times.end(), fn);
    int end_index = start_index + 1;
    if (start_index == 0)
        return 1 + activitySelect(times, end_index, n);
    else
    {
        while (end_index < n && times[end_index].first < times[start_index].second)
            end_index++;
        if (end_index < n)
            return 1 + activitySelect(times, end_index, n);
        else
            return 0;
    }
=======
int activitySelect(vector<pair<int, int>>& times, int start_index, int n) {
  if (times.empty()) return 0;
  auto fn = [](pair<int, int> p1, pair<int, int> p2) {
    return p1.second < p2.second;
  };
  sort(times.begin(), times.end(), fn);
  int end_index = start_index + 1;
  if (start_index == 0)
    return 1 + activitySelect(times, end_index, n);
  else {
    while (end_index < n && times[end_index].first < times[start_index].second)
      end_index++;
    if (end_index < n)
      return 1 + activitySelect(times, end_index, n);
    else
      return 0;
  }
>>>>>>> dev:cxx/algorithm/common/src/activitySelect.cc
}
